/**
 *
 * 日    期：12-2-23
 */
package com.apes.oap.response;

import com.apes.oap.message.MainMessages;
import com.apes.oap.message.MessageType;

import java.util.Locale;

/**
 * <pre>
 * 功能说明：
 * </pre>
 *
 * @version 1.0
 */
public class ServiceUnavailableErrorResponse extends OapResponse<String> {

	// 注意，这个不能删除，否则无法进行流化
	public ServiceUnavailableErrorResponse() {
	}

	public ServiceUnavailableErrorResponse(String method, Locale locale, Throwable throwable) {
		String message = throwable.getMessage();
		message = message.replaceAll("java.lang.IllegalArgumentException:", "");
		message = message.replaceAll("java.lang.RuntimeException:", "");
		message = message.replaceAll("java.lang.Exception:", "");
		OapResponse<String> response = MainMessages.get(MessageType.ISP_SERVICE_UNAVAILABLE, locale, method, message);
		this.setHeader(response.getHeader()).setBody(response.getBody());
	}
}
